package com.shu.dto;

import com.fasterxml.jackson.annotation.JsonView;
import com.shu.validator.MyConstraint;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Past;
import java.util.Date;

/**
 * @author shujinhao
 */
@Data
public class User {


    public interface UserSimpleView{};
    public interface UserDetailView extends UserSimpleView{};

    @JsonView(UserSimpleView.class)
    @MyConstraint(message = "自定义的校验")
    private String username;
    @JsonView(UserDetailView.class)
    @NotBlank(message = "密码不能为空")
    private String password;
    @JsonView(UserSimpleView.class)
    private String id;
    @JsonView(UserSimpleView.class)
    @Past(message = "生日不能是未来的日期")
    private Date birthday;
}
